package com.bz.xtcx.manager.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ygl
 * @create 2018-09-30
 * @DESCRIPTION
 **/
public class QuerySplitUtil {

    public static String[] splitChar = {",","，"," "};



    public static List<String> getParamList(String params){
        List<String> paramList = new ArrayList<>();
        splitParams(paramList,new String[]{params});
        return  paramList;
    }

    /**
     * 将查询参数进行拆分
     * @param params
     */
    public static List<String> splitParams(List<String> paramList,String[] params){
        for (String param : params) {
            boolean needSplit = false;
            for (String cha : splitChar) {
                if (param.contains(cha)) {
                    needSplit = true;
                    String[] strings = param.split(cha);
                    splitParams(paramList,strings);
                }
            }
            if(!needSplit){
                paramList.add(param);
            }
        }
        return paramList;
    }
}
